package gui;

import java.awt.Color;
import java.awt.Font;
import java.awt.GridBagLayout;
import java.awt.Rectangle;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;

import code.Language;
import code.Settings;

import java.awt.Dimension;
import java.io.File;
import java.util.HashMap;

public class CertificatePersonnel extends JPanel {

	Color c= new Color(0x80, 0x80, 0xFF);
	
	Color TAc = new Color(246, 250, 250);

	private static final long serialVersionUID = 1L;
	private JLabel jLabel = null;
	private JLabel jLabel1 = null;
	private JLabel jLabel2 = null;
	ATOCOmain atocoframe;

	private JLabel jLabel3 = null;

	private JLabel jLabel4 = null;

	private JLabel jLabel5 = null;
	
	private JScrollPane jScrollPane = null;

	private JTextArea jTextArea = null;

	private JLabel jLabel6 = null;
	
	private HashMap labels;
	
	private Settings s;

	/**
	 * This is the default constructor
	 */
	public CertificatePersonnel(ATOCOmain atocoframe) {
		super();
		s = new Settings();
		Language l = new Language();
		labels = l.changeLanguage((String) s.global.get("language"), "CertificatePersonnel", (String) s.global.get("installPath"));
		initialize();
		this.atocoframe=atocoframe;
		System.out.println("CertificatePersonnel --> atocoframe: "+ this.atocoframe);
		
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(772, 445);
		jLabel2 = new JLabel(new ImageIcon((String) s.global.get("installPath") + File.separator + "images/en/store_cert.gif"));
		jLabel2.setBounds(new Rectangle(75, 250, 232, 96));
		jLabel2.setText((String) labels.get("jLabel2"));
		//jLabel2.setForeground(c);
		jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent e) {
				atocoframe.contentPane(new PersonalStoreCertificate(atocoframe, passclass(), "Main"));
			}
		});
		jLabel1 = new JLabel(new ImageIcon((String) s.global.get("installPath") + File.separator + "images/en/listandview_cert.gif"));
		jLabel1.setBounds(new Rectangle(83, 134, 284, 95));
		jLabel1.setText((String) labels.get("jLabel1"));
		//jLabel1.setForeground(c);
		jLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent e) {
				atocoframe.contentPane(new PersonalListCertificate(atocoframe));
			}
		});
		jLabel = new JLabel(new ImageIcon((String) s.global.get("installPath") + File.separator + "images/en/create_cert.gif"));
		jLabel.setBounds(new Rectangle(68, 32, 230, 89));
		jLabel.setText((String) labels.get("jLabel"));
		//jLabel.setForeground(c);
		jLabel.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent e) {
				atocoframe.contentPane(new PersonalCreateCertificate(atocoframe, passclass(), "CertificateMain"));
			}
		});
		jLabel3 = new JLabel(new ImageIcon((String) s.global.get("installPath") + File.separator + "images/en/questionmark.jpg"));
		jLabel3.setBounds(new Rectangle(42, 58, 25, 25));
		jLabel3.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent e) {
				jTextArea.setText((String) labels.get("create"));
			}
		});
		jLabel4 = new JLabel(new ImageIcon((String) s.global.get("installPath") + File.separator + "images/en/questionmark.jpg"));
		jLabel4.setBounds(new Rectangle(42, 165, 25, 25));
		jLabel4.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent e) {
				jTextArea.setText((String) labels.get("view"));
			}
		});
		jLabel5 = new JLabel(new ImageIcon((String) s.global.get("installPath") + File.separator + "images/en/questionmark.jpg"));
		jLabel5.setBounds(new Rectangle(47, 281, 25, 25));
		jLabel5.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent e) {
				jTextArea.setText((String) labels.get("store"));
			}
		});
		jLabel6  = new JLabel((String) labels.get("jLabel6"));
		jLabel6.setBounds(new Rectangle(510, 40, 75, 17));
		jLabel6.setFont(new java.awt.Font("Arial", Font.BOLD, 10));
		jLabel6.setForeground(c);
		this.setBackground(Color.WHITE);
		this.setLayout(null);
		this.add(jLabel, null);
		this.add(jLabel1, null);
		this.add(jLabel2, null);
		this.add(jLabel3, null);
		this.add(jLabel4, null);
		this.add(jLabel5, null);
		this.add(jLabel6, null);
		this.add(getJScrollPane(), null);
		
	}
	
	private JTextArea getJTextArea() {
		if (jTextArea  == null) {
			jTextArea = new JTextArea();
			jTextArea.setBounds(new Rectangle(430, 60, 252, 250));
			jTextArea.setBackground(TAc);
			jTextArea.setEditable(false);
			jTextArea.setLineWrap(true);
			jTextArea.setWrapStyleWord(true);
		}
		return jTextArea;
	}

	private JScrollPane getJScrollPane() {
		if (jScrollPane == null) {
			jScrollPane = new JScrollPane();
			jScrollPane.setBounds(new Rectangle(430, 60, 252, 250));
			jScrollPane.setViewportView(getJTextArea());
		}
		return jScrollPane;
	}
	
	public CertificatePersonnel passclass(){
		return this;
	}

}  //  @jve:decl-index=0:visual-constraint="10,10"
